// UniqueMachineID.h: interface for the CUniqueMachineID class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UNIQUEMACHINEID_H__233CE105_A183_4EB5_8C07_E00CE01F1C6D__INCLUDED_)
#define AFX_UNIQUEMACHINEID_H__233CE105_A183_4EB5_8C07_E00CE01F1C6D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define MAC_ADDRESS_BYTE_LENGTH				6
#define GUID_BYTE_LENGTH					16
#define HARD_DRIVE_SERIAL_NUMBER_LENGTH		4
#define PRODUCT_ID_LENGTH					24


class CUniqueMachineID  
{

	public:

		CUniqueMachineID();
		virtual ~CUniqueMachineID();

		void CreateUniqueMachineID();
		bool UniqueIdFound() const;

		bool operator == (const CUniqueMachineID &obj);

		uint8* MacAddress() const				{ return (uint8*) m_bytMACAddress; }
		uint8* CustomGUID() const				{ return (uint8*) m_bytCustomGUID; }
		uint8* HardDriveSerialNumber() const	{ return (uint8*) m_bytHardDriveSerialNumber; }
		uint8* SystemTimerGUID() const			{ return (uint8*) m_bytSystemTimerGUID; }
		uint8* ProductID() const				{ return (uint8*) m_bytProductID; }

		int MacAddressLength() const			{ return MAC_ADDRESS_BYTE_LENGTH; }
		int CustomGUIDLength() const			{ return GUID_BYTE_LENGTH; }
		int HardDriveSerialNumberLength() const { return HARD_DRIVE_SERIAL_NUMBER_LENGTH; }
		int SystemTimerGUIDLength() const		{ return GUID_BYTE_LENGTH; }
		int ProductIDLength() const				{ return PRODUCT_ID_LENGTH; }

		unsigned char * Serialize ();
        int32			Deserialize (unsigned char * pData);
		int32			Deserialize (unsigned char * pData, int32 nDataLength);     // kharmon.  05-14-07.  #19373.  Added data length parameter.

		int32			SerializedLength () { return m_nSerializedLength; }
		unsigned char * SerializedData () { return m_pData; }

	private:

		int32 m_nSerializedLength;
		unsigned char * m_pData;

		bool8 m_bHardDriveSerialNumberFound;
		bool8 m_bMacAddressFound;
		bool8 m_bCustomGUIDFound;
		bool8 m_bSystemTimerGUIDFound;
		bool8 m_bProductIDFound;

		unsigned char m_bytMACAddress [MAC_ADDRESS_BYTE_LENGTH];
		unsigned char m_bytCustomGUID [GUID_BYTE_LENGTH];
		unsigned char m_bytHardDriveSerialNumber [HARD_DRIVE_SERIAL_NUMBER_LENGTH];
		unsigned char m_bytSystemTimerGUID [GUID_BYTE_LENGTH];
		unsigned char m_bytProductID [PRODUCT_ID_LENGTH];

		void _Reset();
		void _ResetCustomGUID();
		void _ResetHardDriveSerialNumber();
		void _ResetMACAddress();
		void _ResetSystemTimerGUID();
		void _ResetProductID();
		void _GetGUIDFromClient();
		void _GetMacAddressFromClient();
		void _GetHardDriveSerialNumberFromClient();
		void _GetSystemTimerGUID();
		void _GetProductID();
};

#endif // !defined(AFX_UNIQUEMACHINEID_H__233CE105_A183_4EB5_8C07_E00CE01F1C6D__INCLUDED_)
